package com.ungao.tools.generator;

import com.ungao.tools.generator.engine.config.TemplateConfig;
import com.ungao.tools.generator.engine.type.EngineType;

import java.sql.Connection;

public interface Creator {

    /**
     * 设置数据库连接
     *
     * @param connection
     * @return
     * @throws Exception
     */
    Creator connection(Connection connection) throws Exception;

    /**
     * 设置数据库连接
     *
     * @param url
     * @param username
     * @param password
     * @param driver
     * @return
     * @throws Exception
     */
    Creator connection(String url, String username, String password, String driver) throws Exception;

    /**
     * 设置模板配置
     *
     * @param configBuilder
     * @return
     * @throws Exception
     */
    Creator configuration(TemplateConfig configBuilder) throws Exception;

    /**
     * 生成模板文件
     *
     * @param engineType
     * @throws Exception
     */
    void write(EngineType engineType) throws Exception;
}
